import { Suspense } from "react";
import { RouterProvider, createBrowserRouter } from "react-router-dom";
import routes from "./router/routes";
import Loading from "@/components/Loading";
import ErrorBoundary from "@/components/ErrorBoundary";
import "./App.scss";

function App() {
  const router = createBrowserRouter(routes);

  return (
    <ErrorBoundary
      fallback={<div className="error-fallback">页面加载失败</div>}
    >
      <Suspense fallback={<Loading />}>
        <RouterProvider router={router} />
      </Suspense>
    </ErrorBoundary>
  );
}

export default App;
